<template>
  <div class="index page">
    <van-row class="row">
      <van-button type="info" to="choice"
        >单项题{{ choiceList.length }}</van-button
      >
    </van-row>
    <van-row class="row">
      <van-button type="info" @click="goTrueOrFalse">判断题{{trueOrFalselist.length}}</van-button>
    </van-row>
    <van-row class="row">
      <van-button type="warning" @click="goChoice"
        >错题本{{ mistakesList.length }}</van-button
      >
    </van-row>
  </div>
</template>
<script>
import api from "api/api.js";
import { list } from "../choice/data";
import { trueOrFalselist } from "../trueOrFalse/data";
import { setStore, getStore, removeStore } from "@/util/index";
export default {
  name: "index",
  data() {
    return {
      choiceList: list,
      mistakesList: [],
      trueOrFalselist:trueOrFalselist
    };
  },
  methods: {
    goChoice() {
      if (this.mistakesList.length == 0) return;
      this.$router.push({
        path: "/choice",
        query: {
          type: 2,
        },
      });
    },
    goTrueOrFalse() {
      this.$router.push({
        path: "/trueOrFalse",
      });
    },
  },
  created() {
    let mistakesList = JSON.parse(getStore("mistakesList"));
    if (mistakesList) {
      this.mistakesList = mistakesList;
    }
  },
};
</script>

<style lang="less" scoped="scoped">
@import "./index.less";
</style>
